---
title: Configuration
summary: >-
  The Keystatic's config file, where content structures and storage paths are
  defined.
---
Every Keystatic project expects an exported `config`. The `config()` function can be imported from the `@keystatic/core` package:

```typescript
// keystatic.config.ts
import { config } from '@keystatic/core'

export default config({
  // ...
})
```

## Example

Here's an example of a Keystatic `config` that creates a `posts` collection, stored on the local file system within the `src/content/posts` directory.

Each post has a `title` as well as a long-form, WYSIWYG `content` field.

```typescript
// keystatic.config.ts
import { config, fields, collection } from '@keystatic/core';

export default config({
  storage: {
    kind: 'local',
  },
  collections: {
    posts: collection({
      label: 'Posts',
      slugField: 'title',
      path: 'src/content/posts/*',
      format: { contentField: 'content' },
      schema: {
        title: fields.slug({ name: { label: 'Title' } }),
        content: fields.markdoc({ label: 'Content' }),
      },
    }),
  },
});
```

---

## Options

### Branch prefix

`branchPrefix` — scope out what GitHub branches Keystatic should interact with (when using `github` or `cloud` storage kind).

```ts
// keystatic.config.ts
import { config } from '@keystatic/core'

export default config({
  storage: { 
    kind: 'github',
    repo: 'Thinkmill/keystatic',
    branchPrefix: 'my-prefix/'
  }
})
```

Keystatic will only list branches starting with my-prefix/ in the Admin UI, and will only let you create new branches with that prefix.

### Cloud

`cloud` — used to configure the [Keystatic Cloud](/docs/cloud) project if `storage.kind` is set to `cloud`.

### Collections

`collections` — defines repeatable content structures, such as blog posts or testimonials.

Learn more in the [Collections](/docs/collections) page.

### Locale

`locale` — defines the [locale](https://docsmill.dev/npm/@keystatic/core@latest#/.CloudConfig.locales) for the project.

### Singletons

`singletons` — defines one-off content structures, such as a settings or a contact page.

Learn more in the [Singletons](/docs/singletons) page.

### Storage

`storage` — a required property defining Keystatic's `storage` strategy. 

It's `kind` can be set to: 

-  [local](/docs/local-mode) to store and read files directly from your local file system
- [github](/docs/github-mode) to connect to a GitHub repository and read/write files to it
- [cloud](/docs/cloud) to benefit from [Keystatic Cloud](https://keystatic.cloud)'s authentication and image hosting features

```typescript
// keystatic.config.ts
import { config } from '@keystatic/core'

export default config({
  storage: { kind: 'local' }
})
```

### User Interface

`ui` — allows customization of parts of the Keystatic Admin UI. 

Learn more on the [User Interface](/docs/user-interface) page.

---

## Type signature

Find the latest version of the `config` type signature at:&nbsp;[**https://docsmill.dev/npm/@keystatic/core@latest#/.config**](https://docsmill.dev/npm/@keystatic/core@latest#/.config)
